package com.bhcj.telling.view.adapter;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import com.bhcj.telling.view.fragment.GuaTuListFragment;
import com.bhcj.telling.view.fragment.ResolvingFragment;
import com.bhcj.telling.view.fragment.ShakingFragment;
import com.bhcj.telling.view.fragment.ThrowCoinsFragment;

public class MainAdapter extends FragmentStateAdapter {
    private ResolvingFragment resolvingFragment = ResolvingFragment.newInstance(new Bundle());
    private GuaTuListFragment guaTuListFragment = GuaTuListFragment.newInstance(new Bundle());
    private ShakingFragment shakingFragment = ShakingFragment.newInstance(new Bundle());
    private ThrowCoinsFragment throwCoinsFragment = ThrowCoinsFragment.newInstance(new Bundle());


    //1.创建Fragment数组
    public MainAdapter(@NonNull FragmentActivity fragmentActivity) {
        super(fragmentActivity);
    }

    public int getItemCount() {
        return 3;
    }

    @NonNull
    public Fragment createFragment(int position) {
        switch (position) {
            case 0:
                return throwCoinsFragment;
            case 1:
                return guaTuListFragment;
            case 2:
                return resolvingFragment;
        }
        return null;
    }


}
